package com.qf.service.impl;

import com.qf.entity.TAcountRecord;
import com.qf.events.UpdateAcountRecordEvent;
import com.qf.mapper.AcountRecordMapper;
import com.qf.service.AcountRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/*
杨威
2021/10/30
16:20
*/
@Service
@Transactional
public class AcountRecordServiceImpl implements AcountRecordService {
    @Autowired
    AcountRecordMapper acountRecordMapper;
    @Autowired
    ApplicationContext context;
    @Override
    public void addAcountRescord(TAcountRecord tAcountRecord) {
        //判断非空 表太多了 暂时没写
        acountRecordMapper.insertAcountRecord(tAcountRecord);
        context.publishEvent(new UpdateAcountRecordEvent());
    }

    @Override
    public void deleteAcountRescord(Long id) {
        acountRecordMapper.deleteAcountRecord(id);
        context.publishEvent(new UpdateAcountRecordEvent());
    }
}
